package com.xxxx.web.dto;

import com.xxxx.web.entity.*;
import com.xxxx.web.enums.*;
import com.xxxx.web.tools.dto.BaseDto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

/**
 * 库存记录表类
 */
@Data
public class InventoryRecordDto extends BaseDto {


    /**
     * 库存数量
     */
    @JsonProperty("StockQty")
    private Double StockQty;


    /**
     * 货主
     */
    @JsonProperty("CustomerId")
    private Integer CustomerId;


    /**
     * 商品
     */
    @JsonProperty("CargoId")
    private Integer CargoId;


    /**
     * 库位
     */
    @JsonProperty("WarehouseBinId")
    private Integer WarehouseBinId;


    /**
     * 仓库
     */
    @JsonProperty("WarehouseId")
    private Integer WarehouseId;

    @JsonProperty("WarehouseDto")
    private WarehouseDto WarehouseDto;

    @JsonProperty("CargoDto")
    private CargoDto CargoDto;

    @JsonProperty("CustomerDto")
    private CustomerDto CustomerDto;

    @JsonProperty("WarehouseBinDto")
    private WarehouseBinDto WarehouseBinDto;

    /**
     * 把库存记录表传输模型转换成库存记录表实体
     */
    public InventoryRecord MapToEntity() throws InvocationTargetException, IllegalAccessException {
        InventoryRecord InventoryRecord = new InventoryRecord();

        BeanUtils.copyProperties(InventoryRecord, this);

        return InventoryRecord;
    }

}
